<template>
  <div class="guide">
    <!-- 顶部核心查询区 -->
    <div class="top-search-section">
      <div class="header-content">
        <div class="brand-section">
          <div class="brand-icons">
            <span class="map-icon">🗺️</span>
            <span class="leaf-icon">🍃</span>
          </div>
          <div class="brand-text">
            <h1 class="page-title">城市环保指南</h1>
            <p class="subtitle">0.2秒查分类，找最近投放点</p>
          </div>
        </div>
        
        <div class="search-area">
          <div class="search-container">
            <input 
              type="text" 
              class="search-input" 
              v-model="searchQuery" 
              placeholder="输入物品名称，如：灯管、过期化妆品"
              @keyup.enter="quickSearch"
            >
            <button class="search-btn" @click="quickSearch">查询分类</button>
            <button class="voice-btn">🎤 语音输入</button>
          </div>
        </div>
      </div>
    </div>
    
    <div class="guide-layout">
      <div class="main-content">
        <!-- 左侧功能导航区 -->
        <aside class="left-navigation">
          <div class="nav-section">
            <h2>热门查询分类</h2>
            <div class="category-list">
              <div class="category-item">
                <span class="category-name">垃圾分类</span>
                <span class="frequency-tag">高频</span>
              </div>
              <div class="category-item">
                <span class="category-name">回收点查询</span>
                <span class="frequency-tag">高频</span>
              </div>
              <div class="category-item">
                <span class="category-name">环保政策</span>
              </div>
              <div class="category-item">
                <span class="category-name">低碳常识</span>
              </div>
            </div>
          </div>
          
          <div class="nav-section">
            <h2>纠错与反馈</h2>
            <div class="correction-module">
              <button class="correction-btn" @click="showCorrectionFormMethod">
                <span class="edit-icon">✏️</span>
                <span class="btn-text">一键纠错</span>
              </button>
              <p class="correction-note">提交未收录词条，得感谢积分</p>
            </div>
          </div>
          
          <div class="nav-section">
            <h2>辅助工具</h2>
            <div class="tools-list">
              <div class="tool-item">
                <span class="tool-icon">⭐</span>
                <span class="tool-name">我的积分</span>
              </div>
              <div class="tool-item">
                <span class="tool-icon">❤️</span>
                <span class="tool-name">收藏夹</span>
              </div>
            </div>
          </div>
        </aside>
        
        <!-- 中间主内容区 -->
        <main class="main-section">
          <!-- 查询结果展示 -->
          <div class="result-section" v-if="searchResult">
            <div class="result-header">
              <h2>查询结果</h2>
              <p class="query-keyword">查询关键词：{{ searchQuery }}</p>
              <p class="authority-result">同城权威分类：<span class="category-tag" :class="searchResult.categoryClass">{{ searchResult.category }}</span></p>
            </div>
            
            <div class="result-content">
              <!-- 左栏：投放点地图 -->
              <div class="map-column">
                <h3>附近投放点地图</h3>
                <div class="map-container">
                  <div class="map-placeholder">
                    <div class="map-markers">
                      <div 
                        class="map-marker" 
                        v-for="(point, index) in searchResult.disposalPoints" 
                        :key="index"
                        :style="{ top: point.y + '%', left: point.x + '%' }"
                      >
                        {{ index + 1 }}
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              
              <!-- 右栏：投放点列表 -->
              <div class="list-column">
                <h3>投放点列表</h3>
                <div class="points-list">
                  <div 
                    class="point-item" 
                    v-for="(point, index) in searchResult.disposalPoints" 
                    :key="index"
                    @click="highlightMarker(index)"
                  >
                    <div class="point-icon">📍</div>
                    <div class="point-details">
                      <h4>{{ point.name }}</h4>
                      <p class="address">{{ point.address }}</p>
                      <p class="distance">{{ point.distance }}km</p>
                      <p class="note" v-if="point.note">{{ point.note }}</p>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          
          <!-- 一键纠错提交 -->
          <div class="correction-section" v-if="showCorrectionForm || showCorrectionResult">
            <h2>一键纠错</h2>
            <div class="correction-card" v-if="!showCorrectionResult">
              <div class="correction-form">
                <div class="form-group">
                  <label>未收录词条</label>
                  <input type="text" class="form-input" v-model="correctionItem" :placeholder="searchQuery || '请输入物品名称'">
                </div>
                <div class="form-group">
                  <label>建议分类 / 投放点</label>
                  <input type="text" class="form-input" v-model="correctionCategory" placeholder="请输入建议分类或投放点">
                </div>
                <div class="form-actions">
                  <button class="submit-btn" @click="submitCorrection">提交</button>
                  <button class="cancel-btn" @click="cancelCorrection">取消</button>
                </div>
              </div>
            </div>
            
            <!-- AI临时答案 -->
            <div class="ai-response" v-if="showCorrectionResult">
              <div class="response-card">
                <h3>AI临时答案</h3>
                <div class="ai-content">
                  <p>感谢您的纠错建议！AI已为您生成临时分类结果：</p>
                  <div class="classification">
                    <span class="category-tag" :class="aiResponse.categoryClass">{{ aiResponse.category }}</span>
                    <p class="description">{{ aiResponse.description }}</p>
                  </div>
                  <p class="note">我们的运营团队将在24小时内审核您的建议，审核通过后将推送感谢积分到您的账户。</p>
                </div>
                <div class="response-actions">
                  <button class="confirm-btn" @click="confirmCorrection">确认提交</button>
                  <button class="edit-btn" @click="editCorrection">重新编辑</button>
                </div>
              </div>
            </div>
          </div>
          
          <!-- 默认内容（未搜索时显示） -->
          <div class="default-content" v-if="!searchResult && !showCorrectionForm && !showCorrectionResult">
            <div class="welcome-message">
              <h2>欢迎使用城市环保指南</h2>
              <p>输入物品名称，快速查询垃圾分类信息和最近投放点</p>
            </div>
          </div>
        </main>
        
        <!-- 右侧辅助信息区 -->
        <aside class="right-sidebar">
          <div class="sidebar-section">
            <h3>本周热门查询 Top5</h3>
            <div class="popular-list">
              <div class="popular-item" @click="searchFromPopular('过期化妆品')">
                <span class="rank">1</span>
                <span class="keyword">过期化妆品</span>
              </div>
              <div class="popular-item" @click="searchFromPopular('废旧电池')">
                <span class="rank">2</span>
                <span class="keyword">废旧电池</span>
              </div>
              <div class="popular-item" @click="searchFromPopular('旧衣服')">
                <span class="rank">3</span>
                <span class="keyword">旧衣服</span>
              </div>
              <div class="popular-item" @click="searchFromPopular('废纸箱')">
                <span class="rank">4</span>
                <span class="keyword">废纸箱</span>
              </div>
              <div class="popular-item" @click="searchFromPopular('过期药品')">
                <span class="rank">5</span>
                <span class="keyword">过期药品</span>
              </div>
            </div>
          </div>
          
          <div class="sidebar-section">
            <h3>环保知识小贴士</h3>
            <div class="tips-card">
              <div class="tip-icon">🗑️</div>
              <div class="tip-content">
                <h4>有害垃圾需密封投放</h4>
                <p>有害垃圾如废电池、废灯管等应密封包装后再投放，避免污染环境。</p>
              </div>
            </div>
          </div>
          
          <div class="sidebar-section">
            <h3>积分激励</h3>
            <div class="points-module">
              <p class="current-points">当前积分：<span class="points-value">1250</span></p>
              <p class="points-note">积分可兑换环保周边（如'环保袋、绿植'）</p>
            </div>
          </div>
        </aside>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, inject } from 'vue'
import { getWasteClassification, submitUserCorrection } from '../api/guide'
const triggerPointsToast = inject<(delta: number) => void>('triggerPointsToast')

// 定义垃圾分类信息的类型
interface WasteClassificationItem {
  waste_id: number
  item_name: string
  category: string
  city: string
  description: string
}

interface WasteClassificationResponse {
  success: boolean
  data: {
    items: WasteClassificationItem[]
    meta: {
      page: number
      page_size: number
      total: number
    }
  }
  message?: string
}

// 定义用户提交的类型
interface UserSubmissionResponse {
  success: boolean
  message: string
  data?: {
    submission_id: number
  }
}

// 秒查分类相关数据
const searchQuery = ref('')
const searchResult = ref<any>(null)
const isSearching = ref(false)

// 一键纠错相关数据
const showCorrectionForm = ref(false)
const showCorrectionResult = ref(false)
const correctionItem = ref('')
const correctionCategory = ref('')
const correctionDescription = ref('')
const aiResponse = ref<any>(null)

// 秒查分类功能
const quickSearch = async () => {
  if (!searchQuery.value.trim()) {
    showMessage('请输入物品名称','error')
    return
  }
  
  isSearching.value = true
  
  try {
    // 调用真实API获取垃圾分类信息
    const response = await getWasteClassification({ q: searchQuery.value })
    
    // 处理API响应数据
    // 注意：request工具返回的是response.data，而不是整个response对象
    const responseData = response as unknown as WasteClassificationResponse
    if (responseData && responseData.success && responseData.data && responseData.data.items && responseData.data.items.length > 0) {
      // 使用第一个匹配的结果
      const item = responseData.data.items[0]
      
      // 构造分类样式类名
      let categoryClass = 'other'
      if (item.category && item.category.includes('有害')) {
        categoryClass = 'harmful'
      } else if (item.category && item.category.includes('可回收')) {
        categoryClass = 'recyclable'
      } else if (item.category && item.category.includes('厨余')) {
        categoryClass = 'kitchen'
      }
      
      // 构造模拟的投放点数据（实际应用中应该从API获取）
      const disposalPoints = [
        { name: '附近回收站', address: '朝阳区某某街道123号', distance: 0.5, x: 30, y: 40 },
        { name: '社区环保中心', address: '朝阳区某某社区456号', distance: 1.8, x: 60, y: 30 },
        { name: '街道回收点', address: '朝阳区某某街道789号', distance: 2.3, x: 40, y: 70 }
      ]
      
      searchResult.value = {
        category: item.category || '未知分类',
        categoryClass: categoryClass,
        description: item.description || '暂无详细说明',
        disposalPoints: disposalPoints
      }
    } else {
      // 没有找到匹配项，使用默认分类
      searchResult.value = {
        category: '未知分类',
        categoryClass: 'other',
        description: '未找到该物品的分类信息，请提交纠错帮助我们完善数据库。',
        disposalPoints: [
          { name: '附近回收站', address: '朝阳区某某街道123号', distance: 0.5, x: 30, y: 40 },
          { name: '社区环保中心', address: '朝阳区某某社区456号', distance: 1.8, x: 60, y: 30 },
          { name: '街道回收点', address: '朝阳区某某街道789号', distance: 2.3, x: 40, y: 70 }
        ]
      }
    }
  } catch (error) {
    console.error('查询垃圾分类信息失败:', error)
    showMessage('查询失败，请稍后重试','error')
  } finally {
    isSearching.value = false
  }
}

// 从热门查询发起搜索
const searchFromPopular = (keyword: string) => {
  searchQuery.value = keyword
  quickSearch()
}

// 高亮地图标记
const highlightMarker = (index: number) => {
  // 这里可以添加高亮地图标记的逻辑
  console.log('高亮标记:', index)
}

// 显示纠错表单
const showCorrectionFormMethod = () => {
  showCorrectionForm.value = true
  correctionItem.value = searchQuery.value
}

// 提交纠错
const submitCorrection = async () => {
  if (!correctionItem.value.trim()) {
    showMessage('请输入物品名称','error')
    return
  }
  
  try {
    // 调用真实API提交用户纠错
    const response = await submitUserCorrection({
      term: correctionItem.value,
      ai_temp_answer: correctionCategory.value
    })
    
    // 处理API响应
    // 注意：由于request工具返回的是response.data，而不是整个response对象
    const submitResponse = response as unknown as UserSubmissionResponse
    if (submitResponse && submitResponse.success) {
      aiResponse.value = {
        category: correctionCategory.value || '待审核',
        categoryClass: 'other',
        description: `AI建议将"${correctionItem.value}"归类为${correctionCategory.value || '待审核'}。我们的运营团队将在24小时内审核您的建议。`
      }
      
      showCorrectionForm.value = false
      showCorrectionResult.value = true
      triggerPointsToast?.(2)
    } else {
      showMessage(`提交失败: ${submitResponse?.message || '未知错误'}`,'error')
    }
  } catch (error) {
    console.error('提交纠错失败:', error)
    showMessage('提交失败，请稍后重试','error')
  }
}

// 已移除未使用的分类样式函数，避免TS未使用警告

// 确认提交纠错
const confirmCorrection = () => {
  showMessage('纠错建议已提交，感谢您的反馈！','success')
  showCorrectionResult.value = false
  searchQuery.value = ''
  searchResult.value = null
}

const showMessage = (message: string, type: 'success' | 'error' = 'success') => {
  const toast = document.createElement('div')
  toast.textContent = message
  const base = 'position:fixed;left:50%;bottom:80px;transform:translateX(-50%);padding:10px 16px;border-radius:10px;color:#fff;box-shadow:0 6px 20px rgba(0,0,0,0.25);z-index:9999;font-size:14px;opacity:0.95;'
  const bg = type === 'success' ? 'background:#2E8B57;' : 'background:#E74C3C;'
  toast.setAttribute('style', base + bg)
  document.body.appendChild(toast)
  setTimeout(() => {
    toast.style.transition = 'opacity 0.3s ease'
    toast.style.opacity = '0'
    setTimeout(() => { toast.remove() }, 300)
  }, 1800)
}

// 重新编辑纠错
const editCorrection = () => {
  showCorrectionResult.value = false
  showCorrectionForm.value = true
}

// 取消纠错
const cancelCorrection = () => {
  showCorrectionForm.value = false
  correctionItem.value = ''
  correctionCategory.value = ''
  correctionDescription.value = ''
}
</script>

<style scoped>
.guide {
  padding: 0;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--background-color);
}

.guide-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* 顶部核心查询区 */
.top-search-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  padding: 30px 20px;
  box-shadow: var(--shadow);
  width: 100%;
  box-sizing: border-box;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
  box-sizing: border-box;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.8rem;
}

.brand-text .page-title {
  color: white;
  margin: 0 0 5px 0;
  font-size: 2rem;
}

.brand-text .subtitle {
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-size: 1.1rem;
}

.search-area {
  width: 100%;
}

.search-container {
  display: flex;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.search-input {
  flex: 1;
  padding: 15px 20px;
  border: none;
  border-radius: 30px 0 0 30px;
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
}

.search-btn {
  padding: 15px 25px;
  background-color: white;
  color: var(--primary-color);
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.search-btn:hover {
  background-color: #f0f0f0;
  transform: scale(1.02);
}

.voice-btn {
  padding: 15px 20px;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 0 30px 30px 0;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.voice-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.02);
}

/* 主内容布局 */
.main-content {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* 左侧功能导航区 */
.left-navigation {
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  box-sizing: border-box;
}

.nav-section {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 20px;
  box-sizing: border-box;
}

.nav-section h2 {
  color: var(--text-color);
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.2rem;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.category-item:hover {
  background-color: var(--primary-light);
}

.category-name {
  font-weight: 500;
}

.frequency-tag {
  background-color: #ff6b35;
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
}

.correction-module {
  text-align: center;
}

.correction-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.correction-btn:hover {
  background-color: var(--primary-dark);
  transform: scale(1.02);
}

.correction-note {
  margin: 10px 0 0 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.tools-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.tool-item:hover {
  background-color: var(--primary-light);
}

.tool-icon {
  font-size: 1.2rem;
}

/* 中间主内容区 */
.main-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.result-section {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 25px;
  box-sizing: border-box;
}

.result-header h2 {
  color: var(--text-color);
  margin: 0 0 15px 0;
}

.query-keyword {
  font-size: 1.1rem;
  margin: 0 0 10px 0;
  color: var(--text-light);
}

.authority-result {
  font-size: 1.1rem;
  margin: 0 0 20px 0;
}

.category-tag {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  color: white;
  margin-left: 10px;
}

.category-tag.kitchen {
  background-color: #28a745;
}

.category-tag.recyclable {
  background-color: #007bff;
}

.category-tag.harmful {
  background-color: #dc3545;
}

.category-tag.other {
  background-color: #6c757d;
}

.result-content {
  display: flex;
  gap: 20px;
  height: 400px;
  box-sizing: border-box;
}

.map-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.map-column h3,
.list-column h3 {
  color: var(--text-color);
  margin: 0;
}

.map-container {
  flex: 1;
  border-radius: 10px;
  overflow: hidden;
  box-sizing: border-box;
}

.map-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0f7fa, #c8e6c9);
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}

.map-markers {
  position: relative;
  width: 100%;
  height: 100%;
}

.map-marker {
  position: absolute;
  width: 30px;
  height: 30px;
  background-color: #dc3545;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s;
}

.map-marker:hover {
  transform: scale(1.2);
}

.list-column {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.points-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
}

.point-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  background-color: var(--background-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  box-sizing: border-box;
}

.point-item:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

.point-icon {
  font-size: 1.5rem;
  min-width: 1.5rem;
}

.point-details h4 {
  margin: 0 0 5px 0;
  color: var(--text-color);
}

.point-details p {
  margin: 0 0 3px 0;
  color: var(--text-light);
  font-size: 0.9rem;
}

.distance {
  color: var(--primary-color) !important;
  font-weight: bold;
}

.note {
  color: #ff6b35 !important;
  font-size: 0.8rem;
}

/* 一键纠错区域 */
.correction-section {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 25px;
  box-sizing: border-box;
}

.correction-section h2 {
  color: var(--text-color);
  margin: 0 0 20px 0;
}

.correction-card {
  width: 100%;
  box-sizing: border-box;
}

.correction-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: bold;
  color: var(--text-color);
}

.form-input {
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 1rem;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(66, 185, 131, 0.2);
}

.form-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.submit-btn,
.cancel-btn {
  padding: 12px 25px;
  border: none;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.submit-btn {
  background-color: var(--primary-color);
  color: white;
}

.submit-btn:hover {
  background-color: var(--primary-dark);
  transform: scale(1.05);
}

.cancel-btn {
  background-color: var(--background-color);
  color: var(--text-color);
}

.cancel-btn:hover {
  background-color: #e9ecef;
  transform: scale(1.05);
}

/* AI临时答案样式 */
.ai-response {
  width: 100%;
  box-sizing: border-box;
}

.response-card {
  background-color: var(--background-color);
  border-radius: 15px;
  padding: 25px;
  box-sizing: border-box;
}

.response-card h3 {
  color: var(--text-color);
  margin-top: 0;
  margin-bottom: 20px;
}

.ai-content {
  margin-bottom: 25px;
}

.ai-content p {
  color: var(--text-light);
  margin: 0 0 15px 0;
  line-height: 1.6;
}

.note {
  background-color: var(--primary-light);
  padding: 15px;
  border-radius: 10px;
  color: var(--primary-color) !important;
  font-weight: 500;
}

.response-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.confirm-btn,
.edit-btn {
  padding: 12px 25px;
  border: none;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.confirm-btn {
  background-color: var(--primary-color);
  color: white;
}

.confirm-btn:hover {
  background-color: var(--primary-dark);
  transform: scale(1.05);
}

.edit-btn {
  background-color: var(--background-color);
  color: var(--text-color);
}

.edit-btn:hover {
  background-color: #e9ecef;
  transform: scale(1.05);
}

/* 默认内容 */
.default-content {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 50px 30px;
  text-align: center;
  box-sizing: border-box;
}

.welcome-message h2 {
  color: var(--text-color);
  margin: 0 0 15px 0;
}

.welcome-message p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin: 0;
}

/* 右侧辅助信息区 */
.right-sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.sidebar-section {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 20px;
  box-sizing: border-box;
}

.sidebar-section h3 {
  color: var(--text-color);
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.2rem;
}

.popular-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.popular-item:hover {
  background-color: var(--primary-light);
}

.rank {
  font-weight: bold;
  color: var(--primary-color);
  min-width: 20px;
}

.keyword {
  flex: 1;
  font-weight: 500;
}

.tips-card {
  display: flex;
  gap: 15px;
}

.tip-icon {
  font-size: 2rem;
  min-width: 2rem;
}

.tip-content h4 {
  margin: 0 0 10px 0;
  color: var(--text-color);
}

.tip-content p {
  margin: 0;
  color: var(--text-light);
  line-height: 1.5;
}

.points-module {
  text-align: center;
}

.current-points {
  font-size: 1.1rem;
  margin: 0 0 10px 0;
}

.points-value {
  font-weight: bold;
  color: var(--primary-color);
}

.points-note {
  color: var(--text-light);
  font-size: 0.9rem;
  margin: 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .main-content {
    flex-direction: column;
  }
  
  .left-navigation,
  .right-sidebar {
    width: 100%;
  }
  
  .result-content {
    flex-direction: column;
    height: auto;
  }
  
  .list-column {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .top-search-section {
    padding: 20px 15px;
  }
  
  .header-content {
    gap: 20px;
  }
  
  .brand-text .page-title {
    font-size: 1.8rem;
  }
  
  .search-container {
    flex-direction: column;
  }
  
  .search-input {
    border-radius: 30px;
    margin-bottom: 10px;
  }
  
  .search-btn,
  .voice-btn {
    border-radius: 30px;
    padding: 12px;
  }
  
  .main-content {
    padding: 15px;
    gap: 15px;
  }
  
  .nav-section,
  .result-section,
  .correction-section,
  .sidebar-section {
    padding: 15px;
  }
  
  .result-content {
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .guide {
    padding: 0;
  }
  
  .header-content {
    gap: 15px;
  }
  
  .brand-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .brand-text .page-title {
    font-size: 1.6rem;
  }
  
  .brand-text .subtitle {
    font-size: 1rem;
  }
  
  .main-content {
    padding: 10px;
    gap: 10px;
  }
  
  .point-item {
    padding: 12px;
  }
  
  .form-actions,
  .response-actions {
    flex-direction: column;
  }
  
  .submit-btn,
  .cancel-btn,
  .confirm-btn,
  .edit-btn {
    width: 100%;
  }
}
</style>
